package com.qf.ks.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.qf.ks.constans.ResultCode;


@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class R {
    private int code;

    private String msg;

    private Object result;

    public static R setOk(Object result){


        return setError(ResultCode.SUCCESS,"成功",result);
    }
    public static R setError(Object result) {
//        R r = new R();
//        r.setCode(ResultCode.FAIL);
//        r.setMsg("网络异常,请检查您的网络");
//        r.setResult(result);
        return setError(ResultCode.FAIL, "网络异常,请检查您的网络", result);
    }

    public static R setError(int code,String msg,Object result) {
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        r.setResult(result);
        return r;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }
}
